package com.c.ctgproject.ui.sell.parts

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.c.ctgproject.base.BaseViewModel
import com.c.ctgproject.http.ApiMethods
import com.c.ctgproject.utils.*

class SingleCarPartsViewModel : BaseViewModel() {
    private val mPartList = MutableLiveData<String>()
    val partList: LiveData<String> get() = mPartList

    fun getPartList(carCode: String, page: Int, size: Int) {
        launch({
            MyLog.d("页面:$page")
            mPartList.value = ApiMethods.getApiService().soldAccessories(userToken, carCode, page, size).awaitSync()
        }, {
            mError.value = it.message.handlerNull()
        })
    }
}